<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_Report extends Controller_DefaultTemplate{

public function action_index()
{
	$query = DB::select(array('SUM("browse_count")', 'total_browse'))->from('booklets')->execute();
	$query_array = $query->as_array();
	echo '浏览量:'.$query_array['0']['total_browse'].'</br>';
	echo '随机量:'.$rand_records = ORM::factory('rand_record')->count_all();
}

public function before()
{
	// Run anything that need ot run before this.
	parent::before();

	if (!Auth::instance()->logged_in())
	{
		$this->request->redirect('/user/login');
	}
}

}




